let str: string | number

function getlength(input:string | number): number {
    var str = input as string
    if(str.length) {
        return str.length
    }else {
        var num = input as number
        return num.toString().length
    }
}